# -*- coding: utf-8 -*-
from Public.dbClection import dbClection
import xlrd
from xlutils.copy import copy
class test():
    db = dbClection()
    xzjd_org = db.getOrgid()
    print(xzjd_org)
    # 保单号
    a=xzjd_org[0]
    print(a)
    # # 电子合同
    # b=xzjd_org[1]
    # # 是否生效
    # c=xzjd_org[2]
    policyno = a['REFNO']
    econtract=a['LETTYPE']
    effective=a['STATCODE']
    CHDRNUM=a['CHDRNUM']


    print(policyno,econtract,effective)
    if effective=='IF':
        effective1='生效'
    elif effective=='DC':
        effective1='拒保'
    else:
        effective1 = '其他'

    if econtract=='ZLPOLPAC':
        econtract1='生成'
    else:
        econtract1 = '不生成'

    excelpath = r'C:\Users\tanjm.ext\PycharmProjects\OWB\TestData\Data.xls'
    wtbook = xlrd.open_workbook(excelpath)
    newb = copy(wtbook)
    # sheet = newb.add_sheet('Sheet3')
    sheet = newb.get_sheet(1)
    row=3
    sheet.write(row, 0, policyno)
    sheet.write(row,4,CHDRNUM)
    sheet.write(row, 5, effective1)
    sheet.write(row, 6, econtract1)
    row=row+1



    newb.save(excelpath)








